FROM ubuntu:20.04
RUN sed -i 's/archive.ubuntu/mirrors.aliyun/g' /etc/apt/sources.list \
  && apt update \
  && apt install -y nginx php-fpm php-mysql \
  && mkdir -p /var/run/php \
  && mkdir -p /var/www/html \
  && sed -i '/~ \\\.php/s/#//g;/fastcgi-php.conf/s/#//g;/php7.4-fpm/s/#//g;63s/#//g;/a 404./a\\t\tssi on;\n\t\tssi_silent_errors on;\n\t\tssi_types text/html;' /etc/nginx/sites-available/default \
  && sed -i '/9000;/a\\t\tssi on;\n\t\tssi_silent_errors on;\n\t\tssi_types text/html;' /etc/nginx/sites-available/default \
  && echo '#! /bin/sh\n/usr/sbin/php-fpm7.4\n/usr/sbin/nginx -c /etc/nginx/nginx.conf\nwhile true\ndo\n\tsleep 60\ndone' > /usr/local/bin/start.sh \
  && chmod +x /usr/local/bin/start.sh \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/*
EXPOSE 80
